﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ucReporte.ascx.vb" Inherits="incidencias_ucReporte" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<script language="javascript" type="text/javascript">
    var selectedRow;

    function jsf_ClickDetailButton(nameButton) {
        document.getElementById(nameButton).click();
    }

    function jsf_Redirect(url) {
        window.location.href = url;
    }

    function jsf_SelectRow(grilla_id, grilla_row, keyColumnValue,controlTxt) {

        document.getElementById(controlTxt).value = keyColumnValue;
        var ctl_tabla = document.getElementById(grilla_id);
        var arr_chkbox = ctl_tabla.getElementsByTagName("input");
        var ls_rowstyle = "alttablerowstyle";
        for (var i = 0; i < ctl_tabla.rows.length; i++) {
            if (i > 0) {
                if (ls_rowstyle == "alttablerowstyle") {
                    ls_rowstyle = "rowtablestyle";
                }
                else {
                    ls_rowstyle = "alttablerowstyle";
                }
                //ctl_tabla.rows[i].className = "";
                //ctl_tabla.rows[i].setAttribute("class", ls_rowstyle);
                ctl_tabla.rows[i].className = ls_rowstyle;
            }
        }

        for (var i = 0; i < arr_chkbox.length; i++) {
            if (arr_chkbox[i].getAttribute('type') == 'checkbox') {
                arr_chkbox[i].checked = false;
            }
        }

        arr_chkbox = null;
        //grilla_row.setAttribute("class", "alttablerowstyle selecttablestyle");
        //grilla_row.removeAttribute("style");
        //grilla_row.className = "";
        //grilla_row.setAttribute("style", "background-color:#3399ff;");
        grilla_row.className = grilla_row.className + " selecttablestyle";       
        arr_chkbox = grilla_row.getElementsByTagName("input");
        if (arr_chkbox != null) {
            arr_chkbox[0].checked = true;
        }

    }

    function jsf_SelectRow2(grilla_id, grilla_row, keyColumnValue, controlTxt) {
        document.getElementById(controlTxt).value = keyColumnValue;
        var ctl_tabla = document.getElementById(grilla_id);
        var arr_chkbox = ctl_tabla.getElementsByTagName("input");
        var ls_rowstyle = "#CEDAF2";
        // deselecciono los registros
        for (var i = 1; i < ctl_tabla.rows.length-1; i++) {

            if (ls_rowstyle == "#CEDAF2") {
                ls_rowstyle = "#F7F6F3";
            }
            else {
                ls_rowstyle = "#CEDAF2";
            }
            
                ctl_tabla.rows[i].style.backgroundColor = ls_rowstyle;
            
            
            //ctl_tabla.rows[i].style.backgroundColor = ctl_tabla.rows[i].originalBgColor;
        }

        // desmarco checkbox
        for (var i = 0; i < arr_chkbox.length; i++) {
            if (arr_chkbox[i].getAttribute('type') == 'checkbox') {
                arr_chkbox[i].checked = false;
            }
        }

        arr_chkbox = null;
        //alert(grilla_row.rowIndex);
        // seleccionamos el registro clickado
        grilla_row.originalBgColor = "#3399ff";
        
        ctl_tabla.rows[grilla_row.rowIndex].style.backgroundColor = "#3399ff";
        // marco el check
        arr_chkbox = grilla_row.getElementsByTagName("input");
        if (arr_chkbox != null) {
            arr_chkbox[0].checked = true;
        }
    }
 </script>

<div id="divReporte" runat="server" style="overflow:inherit;">  
    <asp:UpdatePanel ID="up_gvdata" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:GridView ID="gv_lista" runat="server" AllowPaging="True" 
                PageSize="17" AllowSorting="True" Width="100%" CellPadding="0"  >
                <Columns>                    
                    <asp:TemplateField ItemStyle-Width="10px">
                        <ItemTemplate>
                            <asp:CheckBox ID="chkseleccion" runat="server" />
                        </ItemTemplate>                        
                        <ItemStyle Width="10px" />
                    </asp:TemplateField>
                </Columns>    
                <RowStyle BackColor="#F7F6F3" />
                <AlternatingRowStyle BackColor="#CEDAF2" />              
                <PagerStyle BackColor="#336699" Font-Bold="True" Font-Names="Verdana" Font-Size="10px" ForeColor="White" HorizontalAlign="left" />
            </asp:GridView>
            <asp:Label ID="lblRegistros" runat="server" Text="" CssClass="label"></asp:Label>   
            <asp:Label ID="lblSession" runat="server" style="display:none"></asp:Label>  
            <asp:Label ID="lblKeyColumn" runat="server" style="display:none" Text="1"></asp:Label> 
            <input type="hidden" id="hddTypeDoubleClick" runat="server" /> 
            <input type="hidden" id="hhd_SeletedValue" runat="server" />  
            <input type="hidden" id="hdd_DetailButton" runat="server" />         
        </ContentTemplate>       
    </asp:UpdatePanel>      
</div>
